import Vue from 'vue'
// import Avue from '@smallwei/avue';
import VueI18n from 'vue-i18n'
import elementEnLocale from 'element-ui/lib/locale/lang/en' // element-ui lang
import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN'// element-ui lang
import enLocale from './en'
import zhLocale from './zh'
import dolphinSchedulerZhLocale from './locales/dolphin-scheduler/zh_CN';
import dolphinSchedulerEnLocale from './locales/dolphin-scheduler/en_US';
import { getStore } from '@/util/store'
Vue.use(VueI18n)
const Avue = window.AVUE;
const messages = {
  en_US: {
    ...enLocale,
    ...elementEnLocale,
    ...Avue.locale.en,
    ...dolphinSchedulerEnLocale
  },
  zh_CN: {
    ...zhLocale,
    ...elementZhLocale,
    ...Avue.locale.zh,
    ...dolphinSchedulerZhLocale
  }
}

const i18n = new VueI18n({
  locale: getStore({ name: 'language' }) || 'zh_CN',
  messages
})
i18n.$t = i18n.t;
i18n.globalScope = {
  LOCALE: i18n.locale
}


export default i18n;